package cn.wolfcode.wolf2w.util;

import cn.wolfcode.wolf2w.exception.LogicException;
import org.springframework.util.StringUtils;

public class AssertUtils {
/*
*
* */
    public static void  hasLength(String str,String msg) {
        //如果不是有长度:是null并且是空字符串,就抛异常提示用户
        //手机格式要用正则表达式控制用户输入正确的格式
        if (!StringUtils.hasLength(str)) {
            throw new LogicException(msg);
        }
    }
    public static void  isEqual(String str1,String str2,String msg) {
     if(str1==null||str2==null){
         throw new LogicException("参数不能为空");
        }
     if(!str1.equals(str2)){
         throw new LogicException(msg);
        }

    }
}